<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
  <title>add_shared_behaviour (Spec::DSL::Behaviour)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
  <pre><span class="ruby-comment cmt"># File vendor\plugins\rspec/lib/spec/dsl/behaviour.rb, line 8</span>
        <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_shared_behaviour</span>(<span class="ruby-identifier">behaviour</span>)
          <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">behaviour</span>.<span class="ruby-identifier">equal?</span>(<span class="ruby-identifier">found_behaviour</span> = <span class="ruby-identifier">find_shared_behaviour</span>(<span class="ruby-identifier">behaviour</span>.<span class="ruby-identifier">description</span>))
          <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">found_behaviour</span> <span class="ruby-keyword kw">and</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">behaviour</span>.<span class="ruby-identifier">description</span>[<span class="ruby-identifier">:spec_path</span>]) <span class="ruby-operator">==</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">found_behaviour</span>.<span class="ruby-identifier">description</span>[<span class="ruby-identifier">:spec_path</span>])
          <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;Shared Behaviour '#{behaviour.description}' already exists&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">found_behaviour</span>
          <span class="ruby-identifier">shared_behaviours</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">behaviour</span>
        <span class="ruby-keyword kw">end</span></pre>
</body>
</html>